package com.tangyuan.video.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tangyuan.common.result.Result;
import com.tangyuan.common.result.ResultCodeEnum;
import com.tangyuan.model.TyFinance;
import com.tangyuan.video.mapper.TyFinanceMapper;
import com.tangyuan.video.service.ITyFinanceService;
import org.springframework.stereotype.Service;

/**
 * @Description: ty_finance
 * @Author: jeecg-boot
 * @Date:   2024-03-24
 * @Version: V1.0
 */
@Service
public class TyFinanceServiceImpl extends ServiceImpl<TyFinanceMapper, TyFinance> implements ITyFinanceService {

    @Override
    public Result<IPage<TyFinance>> queryPageList(Integer pageNo, Integer pageSize) {
        LambdaQueryWrapper<TyFinance> queryWrapper = new LambdaQueryWrapper<>();
        Page<TyFinance> page = new Page<TyFinance>(pageNo, pageSize);
        return Result.ok(this.page(page, queryWrapper));
    }

    @Override
    public Result<TyFinance> queryById(String id) {
        TyFinance tyFinance = this.getById(id);
        if (tyFinance == null) {
            return Result.build(null, ResultCodeEnum.NO_SEARCH_DATA);
        }
        return Result.ok(tyFinance);
    }
}
